import request from '@/utils/request'

const product = {
  Directory: '/examdirectory/getExamDirectoryById',
  List: '/examinationManager/list',
  Add: '/examinationManager/add',
  Edit: '/examinationManager/updateById',
  Deletes: '/examinationManager/deleteById',
  SetActive: '/examinationManager/setActive',
  Preset: '/examinationPresetManager/getOneExaminationPresetManager'
}

/**
 * @param parameter
 * @returns {*}
 */
// 课程目录
export function directory (parameter) {
  return request({
    url: product.Directory,
    method: 'post',
    data: parameter
  })
}

// 获取考试列表
export function list (parameter) {
  return request({
    url: product.List,
    method: 'post',
    data: parameter
  })
}

// 新建考试
export function add (parameter) {
  return request({
    url: product.Add,
    method: 'post',
    data: parameter
  })
}

// 编辑考试
export function edit (parameter) {
  return request({
    url: product.Edit,
    method: 'post',
    data: parameter
  })
}

// 删除
export function deletes (parameter) {
  return request({
    url: product.Deletes + `?id=${parameter.id}`,
    method: 'post',
    data: parameter
  })
}

// 启用禁用
export function setActive (parameter) {
  return request({
    url: product.SetActive,
    method: 'post',
    data: parameter
  })
}

// 所属预设获取
export function preset (parameter) {
  return request({
    url: product.Preset,
    method: 'post',
    data: parameter
  })
}
